package  
{
	import flash.display.Sprite;
	import flash.geom.Rectangle;
	import flash.text.TextField;
	import flash.text.TextFormat;

	
	
	public class HUD extends Sprite
	{
		[Embed(		source = "../lib/pf_tempesta_five_extended_bold.ttf", 
					fontFamily = 'my_font',
					fontWeight = 'normal',
					fontStyle = 'normal',
					mimeType = 'application/x-font',
					advancedAntiAliasing='true',
					embedAsCFF = 'false')] private var my_font:Class;		

		
		public var general_info:Sprite;
		public var cube_display:Sprite;
		public var activator_display:Sprite;
		
		private var background:Sprite;
		private var level_text_field:TextField;
		private var moves_text_field:TextField;
		
		private var text_format:TextFormat;
		
		private var background_size:Rectangle = new Rectangle(0, 0, 900, 28);
		private var general_info_size:Rectangle = new Rectangle(0, 0, 900, 28);
		
		private var moves_made:int = 0;
		
		
		public function HUD() 
		{	
			//draw_background();
			draw_general_info();			
		}
		
		
		public function set_level(level:int):void
		{
			this.level_text_field.text = String(level);			
			this.level_text_field.setTextFormat(this.text_format);			
		}
		
		private function set_moves(moves:int):void
		{
			this.moves_text_field.text = String(moves);			
			this.moves_text_field.setTextFormat(this.text_format);			
		}
		
		public function increment_moves():void
		{
			this.moves_made++;
			set_moves(this.moves_made);
		}
		
		
		private function draw_general_info():void
		{
			this.general_info = new Sprite();
			this.general_info.x = this.general_info_size.x;
			this.general_info.y = this.general_info_size.y;
			this.addChild(this.general_info);
			
			var level_static_text:TextField = new TextField();
			this.general_info.addChild(level_static_text);			
			level_static_text.width = 100;
			level_static_text.x = 6;
			level_static_text.y = 6;
			level_static_text.embedFonts = true;			
			
			var moves_static_text:TextField = new TextField();
			//this.general_info.addChild(moves_static_text);			
			moves_static_text.width = 100;
			moves_static_text.x = 80;
			moves_static_text.y = 6;
			moves_static_text.embedFonts = true;			
			
			this.level_text_field = new TextField();
			this.general_info.addChild(this.level_text_field);			
			this.level_text_field.width = 100;
			this.level_text_field.x = 54;
			this.level_text_field.y = 6;
			this.level_text_field.embedFonts = true;			

			this.moves_text_field = new TextField();
			//this.general_info.addChild(this.moves_text_field);			
			this.moves_text_field.width = 100;
			this.moves_text_field.x = 130;
			this.moves_text_field.y = 6;
			this.moves_text_field.embedFonts = true;			
			
			this.text_format = new TextFormat();			
			this.text_format.font = "my_font";
			this.text_format.bold = true;
			this.text_format.color = 0xffffff;
			this.text_format.size = 8;
						
			level_static_text.text = "LEVEL:";
			moves_static_text.text = "MOVES:";
			
			this.set_moves(moves_made);
			
			level_static_text.setTextFormat(this.text_format);
			moves_static_text.setTextFormat(this.text_format);
			this.level_text_field.setTextFormat(this.text_format);
		}
		
		
		private function draw_background():void
		{
			this.background = new Sprite();
			this.background.graphics.lineStyle(1, 0, .5);
			this.background.graphics.beginFill(0, .15);
			this.background.graphics.drawRect(background_size.x, background_size.y, background_size.width, background_size.height);
			this.background.graphics.endFill();
			this.addChild(this.background);
		}
		
	}

}